package com.training.content.service.impl;

import java.util.List;
import com.training.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.training.content.mapper.TrainInfoMapper;
import com.training.content.domain.TrainInfo;
import com.training.content.service.ITrainInfoService;

/**
 * 培训计划Service业务层处理
 * 
 * @author training
 * @date 2021-10-25
 */
@Service
public class TrainInfoServiceImpl implements ITrainInfoService 
{
    @Autowired
    private TrainInfoMapper trainInfoMapper;

    /**
     * 查询培训计划
     * 
     * @param trainId 培训计划主键
     * @return 培训计划
     */
    @Override
    public TrainInfo selectTrainInfoByTrainId(Long trainId)
    {
        return trainInfoMapper.selectTrainInfoByTrainId(trainId);
    }

    /**
     * 查询培训计划列表
     * 
     * @param trainInfo 培训计划
     * @return 培训计划
     */
    @Override
    public List<TrainInfo> selectTrainInfoList(TrainInfo trainInfo)
    {
        return trainInfoMapper.selectTrainInfoList(trainInfo);
    }

    /**
     * 新增培训计划
     * 
     * @param trainInfo 培训计划
     * @return 结果
     */
    @Override
    public int insertTrainInfo(TrainInfo trainInfo)
    {
        trainInfo.setCreateTime(DateUtils.getNowDate());
        return trainInfoMapper.insertTrainInfo(trainInfo);
    }

    /**
     * 修改培训计划
     * 
     * @param trainInfo 培训计划
     * @return 结果
     */
    @Override
    public int updateTrainInfo(TrainInfo trainInfo)
    {
        trainInfo.setUpdateTime(DateUtils.getNowDate());
        return trainInfoMapper.updateTrainInfo(trainInfo);
    }

    /**
     * 批量删除培训计划
     * 
     * @param trainIds 需要删除的培训计划主键
     * @return 结果
     */
    @Override
    public int deleteTrainInfoByTrainIds(Long[] trainIds)
    {
        return trainInfoMapper.deleteTrainInfoByTrainIds(trainIds);
    }

    /**
     * 删除培训计划信息
     * 
     * @param trainId 培训计划主键
     * @return 结果
     */
    @Override
    public int deleteTrainInfoByTrainId(Long trainId)
    {
        return trainInfoMapper.deleteTrainInfoByTrainId(trainId);
    }
}
